#include "stdafx.h"

class UiButtonWrapper:public UiButton
{
private:
	MouseEventFunc pLButtonDblClk;
	MouseEventFunc pLButtonDown;
	MouseEventFunc pLButtonUp;
	MouseEventFunc pMouseMove;
public:
	UiButtonWrapper(MouseEventFunc onLButtonDblClk,MouseEventFunc onLButtonDown,
		MouseEventFunc onLButtonUp,MouseEventFunc onMouseMove)
	{
		this->pLButtonDblClk = onLButtonDblClk;
		this->pLButtonDown = onLButtonDown;
		this->pLButtonUp = onLButtonUp;
		this->pMouseMove = onMouseMove;
	}

	virtual int OnLButtonDblClk(UINT fwKeys, int xPos, int yPos) 
	{
		int result = UiButton::OnLButtonDblClk(fwKeys,xPos,yPos);
		this->pLButtonDblClk(fwKeys,xPos,yPos);
		return result;
	}

	virtual int  OnLButtonDown(UINT fwKeys, int xPos, int yPos) 
	{
		int result = UiButton::OnLButtonDown(fwKeys,xPos,yPos);
		this->pLButtonDown(fwKeys,xPos,yPos);
		return result;
	}

	virtual int  OnLButtonUp(UINT fwKeys, int xPos, int yPos) 
	{
		int result = UiButton::OnLButtonUp(fwKeys,xPos,yPos);
		this->pLButtonUp(fwKeys,xPos,yPos);
		return result;
	}

	virtual int  OnMouseMove(UINT fwKeys, int xPos, int yPos) 
	{
		int result = UiButton::OnMouseMove(fwKeys,xPos,yPos);
		this->pMouseMove(fwKeys,xPos,yPos);
		return result;
	}
};

extern "C" __declspec(dllexport) UiButtonWrapper* UiButtonWrapperCtor(MouseEventFunc onLButtonDblClk,MouseEventFunc onLButtonDown,
															   MouseEventFunc onLButtonUp,MouseEventFunc onMouseMove)
{
	//return new UiButton();

	UiButtonWrapper* pObj = new UiButtonWrapper(onLButtonDblClk,onLButtonDown,
		onLButtonUp,onMouseMove);

	return pObj;
}

extern "C" __declspec(dllexport) int UiButtonWrapperGetButtonType(UiButtonWrapper* pObj)
{
	return pObj->GetButtonType();
}

extern "C" __declspec(dllexport) void UiButtonWrapperSetButtonType(UiButtonWrapper* pObj, int nType)
{
	pObj->SetButtonType(nType);
}

extern "C" __declspec(dllexport) int UiButtonWrapperGetButtonMode(UiButtonWrapper* pObj)
{
	return pObj->GetButtonMode();
}

extern "C" __declspec(dllexport) void UiButtonWrapperSetButtonMode(UiButtonWrapper* pObj, int nMode)
{
	pObj->SetButtonMode(nMode);
}

extern "C" __declspec(dllexport) int UiButtonWrapperGetState(UiButtonWrapper* pObj)
{
	return pObj->GetState();
}

extern "C" __declspec(dllexport) void UiButtonWrapperSetState(UiButtonWrapper* pObj, int nState)
{
	pObj->SetState(nState);
}